Note: This tutorial assumes that you have completed the previous tutorials: Running the XV-11 Node. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
The Underlying XV-11 Protocol Explained
Description: This tutorial will walk you through one entire message sent from the XV-11 laser and will tell you exactly what gets output from the unit. This is an advanced tutorial for those interested in the raw data formatting. This is for the older firmware only.Tutorial Level: ADVANCED
Contents
An entire message consists of 1446 bytes. The format consists of:
- 4 header bytes
- 2 "speed" bytes
- 360 points * 4 bytes = 1440 point bytes
Header Format
The four header bytes are:
0xC0 0x00 0xA5 0x5A
Once these four bytes have been received in this order (0x5A followed by 0xA5, etc), you can be sure that this is the beginning of a new round of pings.
Speed Bytes
The next two bytes correspond to the rotational speed of the unit. It appears that this is the approximate time between each ping * 1e8. This number is certainly used by the Neato to PID the motor speed. In our experimentation, PIDing at such a slow rate (5Hz) did not produce significant advantages, so we have dropped the required hardware and software to do this.
0xD1 0xAA
This number is the two bytes combined as a uint16. The ideal value for this is probably 1.0 second / (360 pings * 5 Hz) * 10^8 = 55555. In practice, I've seen values around 53674 in our unit. If the speed is not close to this target number, due to friction or an obstacle blocking rotation, the laser will not output meaningful pings.
Ping Bytes
The next set of bytes consists of 4 bytes per ping for each of 360 pings. The pings start at 0 degrees and then rotate positively, consistent with ROS frame.
0x00 0x06 0x10 0x87
The first two byte set (the 2 least significant 0x10 and 0x87) consists of status bits (0 and 0) and the distance in millimeters (4231) the laser returned.
The first status bit has appeared to be no return due to max range or no reflectivity. This would appear in situations where an object has absorbed the laser or the camera cannot find enough area to make a range determination. A return of 0 is normal and a return of 1 seems to be the max reading.
The second status bit has appeared to be that an object is too close. Since the laser works by calculating laser area and intensity to provide a distance estimate, this bit seems to indicate that the laser return is at the edge of the camera as it kicks in at around 0.6m or less. A return of 0 is normal and a return of 1 seems to be the close obstacle condition.
The rest of the bits are then the return in millimeters, and the approximate range of the laser appears to be from around 60mm through 5000mm.
The next two bytes we have used as the intensity values return with each ping (in the example at 4.2m, only a value of 6 is returned). We have confirmed that these generally go down with range and up with reflectivity increases (off of a whiteboard, for instance). This value is almost certainly brightness off the camera or the area of the laser return on the camera. Most likely, it is a sum of brightness over the area determined to be the laser return.